// 主界面
;
define(function(require, exports, module) {
	'use strict';
	var util = require("util");
	var base = require(CONFIG.BasePath + "js/enterprise/base");
	var router = require("../hash/pageRouter");
	var top = require("../top/top_main");
	var footer = require("../footer/footer_main");
	var pageIndex = 1,
		pageSize = 10,
		totalPageCount = 1,
		totalRecordCount = 0; //分页初始化
	var init = function() {
		inquireHelpPageList1();
		inquireHelpPageList2();
		router.init();
		initEvent();
	};

	var initEvent = function() {

		$(".search").on("click", function() {
			var keyword = $(this).parent().find(".keyword").val();
			location.href = "./help_main_more.html?keyword=" + encodeURI(encodeURI(keyword));
		});

	};


	//查询资讯列表
	var inquireHelpPageList1 = function() {
		base.fnAjax({
			action: "inquireHelpPageList.json",
			nocode: true,
			oData: {
				pageIndex: 1,
				pageSize: 5
			}, //传递参数
			fnSuccess: function(data) {
				if (data.status == 200) {
					var tpl = $("#newsPageListTpl1").html();
					var html = juicer(tpl, data);
					$(".questionsUl1").html(html);

					$(".detail").unbind("click").click(function() {
						var newsId = $(this).attr("id");
						location.href = "./help_detail.html?newsId=" + newsId;
					});
				} else {
					base.alert(3, data.message);
				}
			}
		});
	};

	//查询资讯列表
	var inquireHelpPageList2 = function() {
		base.fnAjax({
			action: "inquireHelpPageList.json",
			nocode: true,
			oData: {
				pageIndex: 2,
				pageSize: 5
			}, //传递参数
			fnSuccess: function(data) {
				if (data.status == 200) {
					var tpl = $("#newsPageListTpl2").html();
					var html = juicer(tpl, data);
					$(".questionsUl2").html(html);
					$(".detail").unbind("click").click(function() {
						var newsId = $(this).attr("id");
						location.href = "./help_detail.html?newsId=" + newsId;
					});
				} else {
					base.alert(3, data.message);
				}
			}
		});
	};

	return {
		init: init
	};
});